home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
Libraries
/
File Dropper 2.0ß1
/
FD Starter
/
FD Interface.h
next >
Wrap
Text File
|
1996-06-04
|
6KB
|
217 lines
/*****
* FD Interface.h
*
* Copyright © 1993 Troy Anderson; All rights reserved.
*
* Written by Troy Anderson
*
* Header file for File Dropper, with all of the prototypes and definitions you need to interface
* with the File Dropper π library. See the comments before the function prototypes below for
* explanations of their use. See the read me accompanying this file for general information
* about what this is and how to use it.
*
* Version 1.1ß3
*****/
#pragma once
/**
** message values
**
** These are the values that will be passed to you via the message parameter in
** ModuleMain.
**/
enum {
eStartup,
eAEInitialize,
eSFInitialize,
eValidateFile,
eProcessFile,
eUserCancelled,
eDispose,
eDoAboutBox,
eQuitting,
eIdle
};
/**
** ModuleDataRec
**
** A pointer to this structure is passed to you in ModuleMain
**/
typedef struct {
FSSpec *theFile;
long refcon;
} ModuleDataRec;
/**
** rAboutStringsID
**
** This is the ID of the STR# resource that you should put your About information
** in. If something is in there, it will be displayed when the user picks the
** About item in the Apple menu.
**/
#define rAboutStringsID 129
/**
** Customization function types
**
** These three function types are needed only if you want to override the standard
** get file stuff.
**/
/*
* You can write your own "file getting" function that is called in stead of
* StandardGetFile if you want to. You may use CustomGetFile, for example, with
* a custom file dialog.
*
* To use this function, return TRUE if theFile points to the file the user selected,
* return FALSE if the user cancelled.
*/
typedef Boolean (*CustomGetFSSpecFunc)( FSSpec *theFile, long *refcon);
/*
* The next function is identical to the one described in Inside Macintosh
* when using a custom file filter function with StandardGetFile.
*
* If you use my built in file getting function (not your own CustomGetFSSpecFunc),
* the optional CustomFileFilterFunc you supply will be sent to StandardGetFile.
*/
typedef pascal Boolean (*CustomFileFilterFunc)( CInfoPBPtr pbp);
/**
** Customization function installation routines
**
** Call these functions to install custom handlers for the GetFile, FileFilter, and DialogHook
** when using the GetFile interface.
**/
void InstallCustomGetFSSpecFunc( CustomGetFSSpecFunc theFunction);
void InstallCustomFileFilterFunc( CustomFileFilterFunc theFunction);
/**
** Setting up status dialog parameters
**
** Call this function to tell File Dropper if you want the status dialog to be shown and
** what info you want in it. If showStatusDialog is TRUE, the dialog will show up while
** files are being processed. If showProgressBar is TRUE, a progress bar (like the Finder's
** file copying progress bar) will be in the status window for you to use (see SetStatusPercentage
** below). If customMessage is not NULL, the pascal string in it will be written in the
** status dialog. CustomMessage would be something like "\pNow processing your files..."
**
** Defaults:
** showStatusDialog is TRUE
** showProgressBar is FALSE
** customMessage is NULL
**
** If you call this function, call it in response to eStartup, eAEInitialize, or eSFInitialize only.
**/
void SetStatusParams( Boolean showStatusDialog, Boolean showProgressBar, StringPtr customMessage);
/**
** Status bar percentage change routine
**
** Call this function to show the user how far along you are on your file. Pass
** in ther percentage (a number from 0 to 100). This only does anything if you have
** previously called SetStatusParams and set showProgressBar to TRUE.
**/
void SetStatusPercentage( short percentage);
/**
** CustomMessage change routine
**
** Call this function to change the text in the customMessage on the fly while you are
** processing files. This only does anything if there is a status dialog (as there is, by
** default).
**/
void ChangeStatusMessage( StringPtr customMessage);
/**
** ModuleMain
**
** This is the entrypoint into your part of the code.
**/
Boolean ModuleMain( short message, ModuleDataRec *moduleData);
/**
** Useful Utilities
**
** You may find the following functions useful, and are free to use them.
**/
/*
* These values can be passed to ErrorAlert, but are meaningless to FailOSErr
*/
typedef enum {
eWrongMachine = 1,
eSmallSize,
eNoMemory,
eBadResourceFile,
eAppleEventError,
eOSError,
eCantReadFile,
eModuleError
}ErrorType;
/*
* Puts up an alert for the user with a message corresponding to error, followed by
* aPString. When the user clicks OK, it returns, the application does not quit.
* aPString can be NULL.
*/
void ErrorAlert( ErrorType error, StringPtr aPString);
/*
* Puts up an alert for the user with aPString as the message. When the user clicks OK,
* it returns, the application does not quit.
*/
void ShowError( StringPtr aPString);
/*
* If error is 0, this function simply returns, otherwise it puts up an
* alert for the user that says that an OS Error occurred, followed by the
* value of error. When the user clicks OK, the application quits. The
* eQuitting message does NOT get sent.
*/
void FailOSErr( OSErr error);
/*
* Returns TRUE if the key corresponding to theKeyCode is being pressed
* at the time of the call
*/
Boolean KeyIsDown( short theKeyCode);
/*
* Constants that can be used in calls to KeyIsDown
*/
#define TAB_KEY (0x30)
#define SPACE_KEY (0x31)
#define COMMAND_KEY (0x37)
#define SHIFT_KEY (0x38)
#define CAPS_LOCK_KEY (0x39)
#define OPTION_KEY (0x3A)
#define CONTROL_KEY (0x3B)